<template>
  <div>
    <transition name="fade">
      <div v-if="show">hello world</div>
    </transition>
    <button @click="change">切换</button>
  </div>
</template>

<script scoped>
export default {
  name: 'BaseTransition',
  data () {
    return {
      show: true
    }
  },
  methods: {
    change () {
      this.show = !this.show
    }
  }
}
</script>

<style scoped>
  .fade-enter,.fade-leave-to{
    opacity: 0;
  }
  .fade-enter-active,.fade-leave-active{
    transition: opacity 1s;
  }
</style>
